#include <fstream>
#include <string>
#include <iostream>

using namespace std;

int main22()
{
	string file1;
	cout<<"please enter file to read:"<<endl;
	cin>>file1;

	fstream ffile;

	ffile.open(file1.c_str(),ios::in|ios::out|ios::binary);
	if(!ffile.is_open())
	{
		cout<<"can't open file:"<<file1<<endl;
		cout<<"error is "<<ffile.rdstate()<<endl;
		return -1;
	}

	int a;
	cout<<"enter on number"<<endl;
	cin>>a;
	ffile.write((char*)&a,sizeof(a));
	ffile.close();

	return 0;
}
